package com.es.dao.impl;

import com.es.dao.TeacherDao;
import com.es.entity.Teacher;
import org.springframework.jdbc.core.JdbcTemplate;

public class TeacherDaoImpl implements TeacherDao {
    private JdbcTemplate jdbcTemplate;
    @Override
    public int save(Teacher teacher) {
        // 预编译的sql
        String sql = "insert into teacher(name) values (?)";
        // 一个是预编译的sql， 后面的每一个参数都是对应前面？设置的值
        int i = jdbcTemplate.update(sql, teacher.getName());
       /* Object obj = null;
        obj.toString();*/
        int j = 10/0;
        return i;
    }

    public JdbcTemplate getJdbcTemplate() {
        return jdbcTemplate;
    }

    public void setJdbcTemplate(JdbcTemplate jdbcTemplate) {
        this.jdbcTemplate = jdbcTemplate;
    }
}
